(function ($app) {
    $app.module('gtPartyApp').controller('pf_scydMeetingDetailCtrl', function ($scope, $http, $modal, $ocLazyLoad, $alert, $loading, $state, $bsRouterState, AuthUser, $timeout, $excel, $partySelect, $filter) {
        $scope.editParams = $bsRouterState.$params($scope);
        $scope.pageId = $bsRouterState.tabs.activeTab;
        $scope.dataModel = {};
        $scope.scydTypeList = [];//“三重一大”类别

        $scope.loadScydTypes=function(){
            $http({
                method: 'get',
                url: '../../api/dictionary/getDictionaryListByDicTypeKey',
                params: {dicTypeKey: 'scydType'}
            }).then(function (result) {
                $scope.scydTypeList = result.data;
                $scope.scydTypeList.filter(x=>$scope.dataModel.scydtypes.findIndex(scyd=>scyd==x.dickey)>=0).map(x=>x.checked=true);
            }, function (resp) {

            });
        };

        $scope.getData = function () {
            $http
            ({
                method: 'get', url: "../../api/partylife/meeting/get",
                params: {
                    'id': $scope.editParams.id
                }
            }).then(function (result) {
                $scope.dataModel = result.data.item;
                $scope.reqFileModel.selectdata.FileRefID = $scope.dataModel.partylifemeetingid;

                $scope.loadScydTypes();
            }, function (resp) {
                $scope.showMsg('错误', '服务器错误：' + resp.data);
            });
        };

        $scope.getData();

        $scope.reqFileModel = {
            selectdata: {FileRefID: '', pageindex: 1, pagesize: 10, ptotal: 0},//查询参数：FileRefID为文件关联ID
            filetype: 71,//文件类型
            items: [],//列表数据地址
            readonly: true,//是否只能查看
            title: '附件',
            addFileButton: '上传'
        };

        $scope.pagechange = function () {
            $bsRouterState.$closeTab($scope);
        };
    });
})(angular);